package com.yyk.yykywd.mvvm.view_model

import androidx.lifecycle.MutableLiveData
import com.yyk.yykywd.AGENT_LAYOUT
import com.yyk.yykywd.bean.BaseBean
import com.yyk.yykywd.mvvm.entity.AgentListBean
import com.yyk.yykywd.mvvm.entity.OpenSeaNumBean
import com.yyk.yykywd.mvvm.model.CustomerModel

/**
 * 文件描述：
 * Created by guo on 2019-12-05.
 */
class CustomerViewModel : BaseViewModel() {
    var from = ""
    var type = ""
    var layoutType = AGENT_LAYOUT

    var getListSuccess = MutableLiveData<AgentListBean>()
    var getOpenSeaNumSuccess = MutableLiveData<OpenSeaNumBean>()
    private val customerModel = CustomerModel()
    var list: MutableList<AgentListBean.Data> = ArrayList()

    fun getAgentCustomer() {
        customerModel.getAgentCustomer(from, type, page.toString(), num.toString(), object : CustomerModel.GetList {
            override fun getInfo(type: AgentListBean) {
                type.data?.let { list.addAll(it) }
                getListSuccess.value = type
            }

            override fun onError(e: String) {
            }

        })
    }

    fun getOpenSeaNum() {
        customerModel.getOpenSeaNum(object : CustomerModel.GetOpenSeaNum {
            override fun getInfo(info: OpenSeaNumBean) {
                getOpenSeaNumSuccess.value = info
            }

            override fun onError(e: String) {
            }

        })
    }
}